<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <title>统一认证--系统选择</title>
    <script type="text/javascript" src="/webjars/js/aes-1.0.5.js"/>
    <script type="text/javascript" src="/webjars/jquery/dist/jquery.min.js"/>

    <link href="/css/tyrz.css" type="text/css" rel="stylesheet"/>

</head>

<body class="login_bg">
<div class="login_tp">
    <span th:text="${userName}"></span>,你好！<a href="javascript:logout();"><span class="logout">退出</span></a>
</div>
<div class="login_xt">
    <div class="title fs24">请点击您要登录的系统</div>
    <div class="dl_chose_box">
        <ul class="clear">

            <li th:each="client:${clientList}" th:onclick="|f('${client.domain}')|" th:text="${client.name}"></li>

        </ul>
    </div>
</div>
<script th:inline="javascript">
    //<![CDATA[
    $(function () {
        var window_h = $(window).height();
        $(".login_xt").css("margin-top", (window_h - $(".dl_chose_box").height() - 80) / 2);
    })

    function f(domain) {
        try{
            var urlReg= /^(https:\/\/|http:\/\/)/;
            if(domain && urlReg.test(domain)){
                // location.href = domain;
                window.open(domain,"_blank");
            }else{
                alert("系统地址未配置");
            }
        }catch (e) {
            alert(e);
        }


    }
    AES.setSecret("aas-apex");
    function logout(){
        var data = new Date().getTime()+"";
        var signature = AES.encryptBase64(data);
        $.post("/acLogout",{
                clientId: [[${clientId}]],
                signature: signature,
                acTicket: [[${acTicket}]]
            },
            function(data,status){
               if(data && data.code==1){
                   //注销成功
                   location.href = "/";
               }else{
                   //注销失败
                   location.href =  "/";
               }
            });
    }

    //]]>
</script>
</body>
</html>